// 用户相关类型定义
export interface User {
  id: string;
  username: string;
  phone: string;
  email?: string;
  avatar?: string;
  createdAt: string;
  updatedAt: string;
}

export interface UserProfile {
  userId: string;
  birthDate: string;
  height: number;
  weight: number;
  gender: 'male' | 'female' | 'other';
  updatedAt: string;
}

// 认证相关类型定义
export interface LoginCredentials {
  username: string;
  password: string;
}

export interface RegisterInfo {
  username: string;
  phone: string;
  password: string;
  confirmPassword: string;
  agreementAccepted: boolean;
}

export interface LoginResult {
  success: boolean;
  message?: string;
  user?: User;
  token?: string;
}

export interface RegisterResult {
  success: boolean;
  message?: string;
  user?: User;
}

export interface AuthToken {
  token: string;
  refreshToken: string;
  expiresAt: number;
}

// 健康数据类型定义
export interface HealthData {
  id?: string;
  userId: string;
  date: string;
  steps: number;
  sleepDuration: number;
  sleepScore: number;
  deepSleep: number;
  heartRate: number[];
  averageHeartRate: number;
  stressLevel: number;
  calories: number;
  distance: number;
  createdAt: string;
  updatedAt: string;
}

export interface SleepData {
  sleepDuration: number;
  sleepScore: number;
  deepSleep: number;
  lightSleep: number;
  remSleep: number;
  bedTime: string;
  wakeTime: string;
  efficiency: number;
}

// API响应类型定义
export interface ApiResponse<T = any> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
  code?: number;
}

// LLM配置类型定义
export interface LLMConfig {
  provider: 'qwen' | 'deepseek' | 'private';
  apiKey: string;
  endpoint?: string;
  isActive: boolean;
}

// 分析结果类型定义
export interface AnalysisResult {
  id: string;
  userId: string;
  type: 'sleep' | 'stress' | 'exercise' | 'general';
  data: any;
  analysis: string;
  recommendations: string[];
  score: number;
  createdAt: string;
}

// 错误类型定义
export interface AppError {
  code: string;
  message: string;
  details?: any;
}